import { PostComments, Share, } from '@/app/(main)/(home)/posts/[slug]/page.client'; import { PostJsonLd } from '@/components/json-ld'; import { RichText } from '@/components/rich-text'; import { Section } from '@/components/section'; import { TagCard } from '@/components/tags/tag-card'; import { createMetadata } from '@/lib/metadata'; import { getPostBySlug, getAllPostSlugs, type BlogPost, } from '@/lib/payload-posts'; import { cn } from '@/lib/utils'; import type { Metadata } from 'next'; import { notFound } from 'next/navigation'; import Balancer from 'react-wrap-balancer'; import { description as homeDescription } from '@/app/(main)/layout.config'; function PostHeader(props: { post: BlogPost }) { const { post } = props; return (

{post.title}

{post.description}

{post.tags?.map((tag) => ( ))}
); } function PostContent({ post }: { post: BlogPost }) { return ( <>
} className="flex-1 px-4" enableProse={true} />

Written by

{post.author}

Created At

{post.date.toDateString()}

Updated At

{post.updatedAt.toDateString()}

); } export default async function Page(props: { params: Promise<{ slug: string }>; }) { const params = await props.params; const post = await getPostBySlug(params.slug); if (!post) { notFound(); } return ; } export async function generateMetadata(props: { params: Promise<{ slug: string }>; }): Promise { const params = await props.params; const post = await getPostBySlug(params.slug); if (!post) { return {}; } return createMetadata({ title: post.title, description: post.description || homeDescription, openGraph: { url: `/posts/${post.slug}`, images: post.image ? [{ url: post.image }] : undefined, }, alternates: { canonical: `/posts/${post.slug}`, }, }); } export async function generateStaticParams(): Promise<{ slug: string }[]> { const slugs = await getAllPostSlugs(); return slugs.map((slug) => ({ slug })); }